﻿//操作会员离开
function Leave()
{
    if(__P_M=="")
    {
        top.location = "/user/login.htm?IsShow=1&ReturnUrl="+top.location.href;return;
    }
         showProgressBar(false,true);  
          $("$divIput$").style.display = "none";
        var leaveDesc="<div style='width:370px; overflow:hidden'>"+GP115.replace(/\{0\}/gi,groupTitle)+"</div><br/><div class='Popup_button'><input value='"+GP230+"' class='button' onclick='opWebSerLeave()' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";     
        var obj = {}
        $ShowMessageBox$(leaveTitle,leaveDesc,obj,webFailure,400);
}
//执行离开
function opWebSerLeave()
{
    $EndMessageBox$();
    $("LeaveGID").value=groupID;
    $("Form1").action = lhost+"/groups/my-groups.htm";
    $("Form1").submit();
}
//加入组
function Join(jo)
{
    if(__P_M=="")
    {
        top.location = lhost+"/user/login.htm?IsShow=1&ReturnUrl="+top.location.href;return;
    }
   if(jo=="2")
   {
    showProgressBar(false,true); 
     $("$divIput$").style.display = "none";
        var _joinDesc="<div style='width:370px; overflow:hidden'>"+joinDesc+"</div><br/><div class='Popup_button'><input value='"+GP232+"' class='button' onclick='opWebSerJoin()' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";     
        var obj = {}
        $ShowMessageBox$(joinTitle,_joinDesc,obj,webFailure,400);
    }
    else
    {
    $("$divIput$").style.display = "none";
        var _joinDesc1="<div style='width:370px; overflow:hidden'>"+joinDesc1+"</div><br/><div class='Popup_button'><input value='"+GP231+"' class='button' onclick='opWebSerJoin1()' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";   
        var obj = {}
      $ShowMessageBox$(joinTitle,_joinDesc1,obj,webFailure,400);

    }
}
//加入组需要验证的掉用WebServices方法操作
function opWebSerJoin()
{
    WebServices.WWW.Groups.JoinGroup(groupID,NickName,groupTitle,onsuccGroup,webFailure);
}
//加入组不要验证的表单提交刷新操作
function opWebSerJoin1()
{

$EndMessageBox$();
    $("Rety").value="join";
    $("Form1").action = top.location;
    $("Form1").submit();
}
//加入组需要验证的掉用WebServices方法操作成功时候
function onsuccGroup(result)
{
    if(result.State)
    {
            $EndMessageBox$();
            window.location.reload();
    }
    else
    {
        $EndMessageBox$();
    }
}
//调用webService方法失败
function webFailure()
{
    $EndMessageBox$();
}
//申请管理员
function AppAdmin()
{
    if(__P_M==""){$Login$();return;}
    showProgressBar(false,true);
     $("$divIput$").style.display = "none";
    var appAdminBody=GP116+":<br/><div id='AppAdminError' style='display:none' class='red10'>"+ST155+"</div><textarea id='AppAdminInfo' rows='5' class='common100D'></textarea><br/><div class='Popup_button'><input id='btnAppAdmin' value='"+GP224+"' class='button' onclick='opWebSerAppAdmin()' type='button'/>&nbsp;&nbsp;<input type='button' value='"+C0056+"' class='buttong' onclick='webFailure()' /></div>";     
    var obj = {}
    $ShowMessageBox$(appAdminTitle,appAdminBody,obj,webFailure);    
 
}
//确定申请管理员
function opWebSerAppAdmin()
{
    var message=$("AppAdminInfo").value;
    if(message.length<3||message.length>1000)
    {
        $("AppAdminError").style.display = ""
        return;
    }
    $("AppAdminError").style.display = "none"
    WebServices.WWW.Groups.AppAdmin(groupID,NickName,groupTitle,message,onsuccGroup1,webFailure);      
}
//申请管理员成功
function onsuccGroup1(result)
{
        $EndMessageBox$();
}
//添加帖
function AddTopic()
{
    if(__P_M=="")
    {
        $Login$();return;
    }
    
    $("Rety").value=groupTitle;
    $("Form1").action = "/groups/"+groupID+"/add-topic.htm";
    $("Form1").submit();
}